package cn.cs.controller;

import cn.cs.common.Constants;
import cn.cs.common.Dto;
import cn.cs.common.EmptyUtils;
import cn.cs.service.ParentAndChildService;
import cn.cs.vo.MonthVo;
import cn.cs.vo.ParentAndChildVo;
import cn.cs.vo.SlideShowVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 亲子首页Controller
 */
@RestController
@RequestMapping(value = "/api/p")
public class ParentAndChildController {

    @Autowired
    private ParentAndChildService parentAndChildService;

    /**
     * 根据分类查询轮播图
     *
     * @param param - itemTypeId 商品分类主键
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/querySlideShowPic", method = RequestMethod.POST)
    public Dto<List<SlideShowVo>> querySlideShowPic(@RequestBody Map<String, Object> param, HttpServletResponse response) throws Exception {
        Integer itemTypeId = Integer.parseInt(param.get("itemTypeId").toString());
        return parentAndChildService.querySlideShowPic((long) itemTypeId);
    }

}
